<?php
/**
 *
 */
class UI_Form_RadioGroup extends Z_Component {

    public function __construct($label,$name,$values,$horizontal=false) {

	$horizontal = ($horizontal) ? "data-type=\"horizontal\"" : "";

	parent::__construct("<div data-role=\"fieldcontain\"><fieldset data-role=\"controlgroup\" $horizontal> ","</fieldset></div>" );

	$text = "<legend>$label</legend>";

	foreach ($values as $key => $value) {
	    $text .= "<input type=\"radio\" name=\"$name\" id=\"$key\" class=\"custom\" />
				<label for=\"$key\">$value</label> ";
	}
	
	$this->add(new Z_Html_Text($text));
	
    }
    
}
